<?php
namespace wepay\join\demo\api;
//base64方法
class WebBase{

    public function encode($str){
        $base64str= base64_encode($str);
        $base64str = str_replace("+", "-",  $base64str);
        $base64str = str_replace("/","_",  $base64str);
        $base64str = str_replace("=",".",  $base64str);
        return $base64str;
    }

    public function decode($str){

        $str = str_replace("-", "+",  $str);
        $str = str_replace("_","/",  $str);
        $str = str_replace(".","=",  $str);
        $unbase64str=base64_decode($str);
        return $unbase64str;
    }
}

?>